<?php
require_once('simpletest/autorun.php');
require_once('requests.php');

class TestOfCompanyClass extends UnitTestCase{
	function testCreateNewCompany()
	{
		//delete if exists
		GET("http://127.0.0.1/project-advertise-on-car/persons/person/pero@pis.com/delete");
		
		$company = array("company" => array(
					"user" => array("username" => "pero.firma", "email" => "pero@pis.com", "password" => "mojasifra", "phone" => "091/1234-532"), 
					"name" => "Pero i sinovi d.o.o.", 
					"address" => "Imotski 45"
				  ));
				  
		
		$resp = POST("http://127.0.0.1/project-advertise-on-car/companys/company?format=json", json_encode($company));
		echo($resp);
		echo json_encode($company);
		$firma = GET("http://127.0.0.1/project-advertise-on-car/companys/company/" . $company['company']['user']['email'] . "?format=json");
		
		$firma = json_decode($firma);
		
		$this->AssertEqual($firma->company->name, $company['company']['name']);
		
		
	}
}

?>